-
Notifications
You must be signed in to change notification settings - Fork 106
chore: 553: Addressed PR comments from Pull request 564. #599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ted to PushNotificationConfig pagination feature
Summary of ChangesHello @Sathyvs, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses previous review comments by refactoring the pagination logic in JpaDatabasePushNotificationConfigStore to be cleaner and more robust. Key improvements include making the maximum page size configurable, validating page tokens more strictly, and updating tests to cover these changes. The code is well-structured, and the new test cases are thorough. I have a couple of suggestions to improve exception handling and code style.
| } catch (Exception e) { | ||
| LOGGER.warn("Failed to read '{}' configuration, falling back to default page size of {}.", | ||
| A2A_PUSH_NOTIFICATION_MAX_PAGE_SIZE_CONFIG, A2A_PUSH_NOTIFICATION_DEFAULT_MAX_PAGE_SIZE, e); | ||
| maxPageSize = A2A_PUSH_NOTIFICATION_DEFAULT_MAX_PAGE_SIZE; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catching the generic Exception is overly broad and can hide other unexpected issues. It's better to catch the specific exceptions you expect, such as IllegalArgumentException (if the config value is missing from the provider) and NumberFormatException (if the value is not a valid integer). This makes the error handling more precise and robust.
| } catch (Exception e) { | |
| LOGGER.warn("Failed to read '{}' configuration, falling back to default page size of {}.", | |
| A2A_PUSH_NOTIFICATION_MAX_PAGE_SIZE_CONFIG, A2A_PUSH_NOTIFICATION_DEFAULT_MAX_PAGE_SIZE, e); | |
| maxPageSize = A2A_PUSH_NOTIFICATION_DEFAULT_MAX_PAGE_SIZE; | |
| } | |
| } catch (IllegalArgumentException | NumberFormatException e) { | |
| LOGGER.warn("Failed to read or parse '{}' configuration, falling back to default page size of {}.", | |
| A2A_PUSH_NOTIFICATION_MAX_PAGE_SIZE_CONFIG, A2A_PUSH_NOTIFICATION_DEFAULT_MAX_PAGE_SIZE, e); | |
| maxPageSize = A2A_PUSH_NOTIFICATION_DEFAULT_MAX_PAGE_SIZE; | |
| } |
| "Should have nextPageToken since more configs remain"); | ||
|
|
||
| // Verify we can iterate through all pages and get all 7 configs | ||
| List<String> allConfigIds = new java.util.ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fully qualified name java.util.ArrayList is used here. It would be more conventional to import java.util.ArrayList at the top of the file and use the short name new ArrayList<>(). This improves readability. A similar simplification can be applied to new java.util.HashSet<>() on line 589 by importing java.util.HashSet.
| List<String> allConfigIds = new java.util.ArrayList<>(); | |
| List<String> allConfigIds = new ArrayList<>(); |
Changes related to PushNotificationConfig pagination feature
Description
Addresses PR comments from PR 564
Fixes #553 🦕